package com.zy.web.demo.duoxiancheng.demo16;

/**
 * @author <a href="mailto:zhouyong@cqyyt.com">zy</a>
 * @version 1.0
 * @date 2020/8/17 15:05
 */
public class ThreadA16 extends Thread{

    public static final int zy = 5;
    private Object object;

    public ThreadA16( Object object){
        super();
        this.object = object;
    }

    @Override
    public void run() {
        try {
            synchronized (object){
                if ( MyList16.size() != zy ){
                    System.out.println(Thread.currentThread().getName()+"，wait开始，时间"+System.currentTimeMillis());
                    object.wait();
                    System.out.println(Thread.currentThread().getName()+"，wait结束，时间"+System.currentTimeMillis());
                }
            }
        }catch (InterruptedException e){
            e.printStackTrace();
        }
    }
}
